import request from '@/utils/request'
import { getHost, getHeaderType } from '@/utils/host'

export function getPageArticleList(data) {
  return request({
    method: 'post',
    url: '/article/getPageArticle',
    baseURL: getHost(),
    data: data,
    headers: getHeaderType()
  })
}

export function saveArticle(data) {
  return request({
    method: 'post',
    url: '/article/saveArticle',
    baseURL: getHost(),
    data: data,
    headers: getHeaderType()
  })
}

export function updateArticle(data) {
  return request({
    method: 'post',
    url: '/article/updateArticle',
    baseURL: getHost(),
    data: data,
    headers: getHeaderType()
  })
}

export function getArticleById(id) {
  return request({
    method: 'get',
    url: '/article/getArticleById',
    baseURL: getHost(),
    params: { id: id },
    headers: getHeaderType()
  })
}

export function delArticle(id) {
  return request({
    method: 'post',
    url: '/article/delArticle',
    baseURL: getHost(),
    params: { id: id },
    headers: getHeaderType()
  })
}

export function updateStatus(id, status) {
  return request({
    method: 'post',
    url: '/article/updateStatus',
    baseURL: getHost(),
    params: { id: id, status: status },
    headers: getHeaderType()
  })
}
